package com.ty.config;

import com.alibaba.cloud.nacos.ribbon.NacosRule;
import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import com.ty.rule.MyRule;
import org.springframework.cloud.netflix.ribbon.RibbonClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@RibbonClients(defaultConfiguration = MyRule.class)
public class RibbonConfig {

    //全局配置负载均衡策略
    @Bean
    public IRule rule (){
       // return new RandomRule();
       //  return new NacosRule();
        return new MyRule();
    }
}
